import axios from './request'
import {getUsername} from './auth'

export default async function () {
  let url = process.env.QLIK_TICKET_API
  try{
    let res = await axios.post(`${url}/get_ticket?user=${getUsername()}&userDir=LENOVOAD`)
    let ticket = res.data.data.Ticket
    return new Promise((resolve) => {
      resolve(ticket)
    })
  } catch (err) {
    return new Promise((resolve, reject) => {
      reject()
    })
  }
}
